<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ include file="/WEB-INF/views/include/constrant.jsp"%>
<html>
<head>
<link href="${ctxStatic }/xiake/css/list.css" rel='stylesheet' type='text/css' />
<script src="${ctxStatic}/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="${ctxStatic}/form-validate/jquery.validate.js" type="text/javascript"></script>
<script src="${ctxStatic}/layer/layer.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
	$("#bookingForm").validate({
		rules: {
			boardaddr: "required",
			contacts: {
				required: true,
			},
			payertel:{
				required: true,
				isMobile : true
			}
		},
		messages: {
			boardaddr: "必填",
			contacts: {
				required: "必填",
			},
			payertel: {
				required: "必填",
				isMobile : "请正确填写您的手机号码"
			}
		},//重写showErrors
	    showErrors: function (errorMap, errorList) {
	        var msg = "";
	        $.each(errorList, function (i, v) {
	            //在此处用了layer的方法,显示效果更美观
	            layer.tips(v.message, v.element, { time: 3000 });
	            return false;
	        });  
	    }
	});
	jQuery.validator.addMethod("isMobile", function(value, element) {
        var length = value.length;
        var mobile = /^(13[0-9]{9})|(18[0-9]{9})|(14[0-9]{9})|(17[0-9]{9})|(15[0-9]{9})$/;
        return this.optional(element) || (length == 11 && mobile.test(value));
    }, "请正确填写您的手机号码");
});	
</script>
</head>
<body>
		<input type="hidden" id="menuInfo" value="indexDemands">
		<form id="bookingForm" action="${ctx}/rentproduct/demands/booking" method="post">
			<c:set var="genOrdername" value="${tDemands.departcity.sitename}-${tDemands.destcity.sitename}${tDemands.rentdays }日定制包车"/>
			<input type="hidden" name="ordername" value="${genOrdername }" />
			<input type="hidden" name="dueamount" value="${react.price}"/>
			<input type="hidden" name="demandid" value="${tDemands.demandid}"/>
			<input type="hidden" name="reactid" value="${react.reactid }" />
			<input type="hidden" name="ordertype" value="c" />
			<input type="hidden" name="bookingdays" value="${tDemands.rentdays }" />
			<input type="hidden" name="cargotypeid" value="${tDemands.cartype.cargotypeid }" />
			<input type="hidden" name="office.id" value="${react.office.id }" />
			<input type="hidden" name="realscheid" value="${react.reactid }" />
			<input type="hidden" name="departdateStr" value="<fmt:formatDate value="${tDemands.fromdate}" pattern="yyyy-MM-dd HH:mm:ss"/>" />
			<%-- <div class="container_date font_large_size">
				<span>${genOrdername }</span>
				<p>
					<fmt:formatDate value="${tDemands.fromdate}" pattern="yyyy-MM-dd HH:mm"/>
				</p>
			</div> --%>
			<div class="container_information font_normal_size">
				<div>
					<label class="control-label">车型</label>
					<input type="text" value="${tDemands.cartype.typename }（${react.remarks }）" readonly/>
					<span class="help-inline">
					<font color="red">*</font> </span>
				</div>
				<div>
					<label>车辆数</label>
					<input id="purchasenum" type="text" name="purchasenum" value="${tDemands.vehiclenum }" readonly/>
					<span class="help-inline">
					<font color="red">*</font> </span>
				</div>
				<div>
					<label>上车地点</label>
					<input type="text" name="boardaddr" value="${orders.boardaddr }" />
					<span class="help-inline">
					<font color="red">*</font> </span>
				</div>
				<div>
					<label>上车时间</label>
					<input type="text" readonly="readonly" value="<fmt:formatDate value="${tDemands.fromdate }" pattern="yyyy-MM-dd E HH:mm"/>"/>
					<span class="help-inline">
					<font color="red">*</font> </span>
				</div>
				<div>
					<label>联系人姓名</label>
					<input type="text" name="contacts" value="${empty orders.contacts?tDemands.contactor:orders.contacts }" />
					<span class="help-inline">
					<font color="red">*</font> </span>
				</div>
				<div>
					<label>联系电话</label>
					<input type="text" name="payertel" value="${empty orders.payertel?tDemands.contactphone:orders.payertel }" />
					<span class="help-inline">
					<font color="red">*</font> </span>
				</div>
				<div style="height: 80px;margin: 18px 0">
					<label style="vertical-align: top;">行程备注</label>
					<textarea rows="5" readonly name="remarks">${tDemands.remarks }</textarea>
				</div>
			</div>
			<div class="control-group" style="margin: 10px 0">
				<label class="control-label"></label>
				<div class="container_submit_c font_normal_size">
					一口价：<span class="font_large_size main_color" id="suitrtnprice">￥${react.price}</span>
					<div onclick="$('#bookingForm').submit();" class="container_sorder_zf pointer">提交</div>
				</div>
				<a class="herfnew"  href="${ctx }/rentproduct/demands">查看我的包车</a>
		</div>
		</form>
</body>
</html>